package com.molichuxing.services.infrastructure.service.impl;

import com.alibaba.fastjson.JSON;
import com.molichuxing.framework.dto.Paged;
import com.molichuxing.services.infrastructure.bean.GoodsDealerBean;
import com.molichuxing.services.infrastructure.bean.GoodsIntroduceBean;
import com.molichuxing.services.infrastructure.convertor.Convert;
import com.molichuxing.services.infrastructure.dao.GoodsDealerMapper;
import com.molichuxing.services.infrastructure.dao.GoodsIntroduceMapper;
import com.molichuxing.services.infrastructure.dto.response.GoodsDealerDto;
import com.molichuxing.services.infrastructure.dto.response.GoodsIntroduceDto;
import com.molichuxing.services.infrastructure.service.GoodsAuthService;
import com.molichuxing.services.infrastructure.service.GoodsIntroduceService;
import com.molichuxing.services.property.GoodsDealerStatusEnum;
import com.molichuxing.services.property.GoodsTypeEnum;
import com.molichuxing.services.property.GoodsTypeIntroduceEnum;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;

/**
 * <p>
 * 商品分销 服务实现类
 * </p>
 *
 * @author xuelin yi
 * @since 2019-08-12
 */
@Service("goodsIntroduceService")
public class GoodsIntroduceServiceImpl implements GoodsIntroduceService {

    private static final Logger log = Logger.getLogger(GoodsIntroduceServiceImpl.class);

    @Resource
    private GoodsIntroduceMapper goodsIntroduceMapper;

    @Override
    public List<GoodsIntroduceDto> getGoodsIntroduce(GoodsTypeIntroduceEnum goodsTypeEnum) {
        List<GoodsIntroduceBean> result = goodsIntroduceMapper.getByGoodsType(goodsTypeEnum.getValue());
        return Convert.toGoodsIntroduceDto(result);
    }
}
